package com.ourteam.product.model.api;

import org.apache.commons.lang3.StringUtils;

import com.ourteam.frame.web.AbstractSearchModel;
import com.ourteam.product.model.dao.ProductModelServiceTemplateDAOQueryBean;
import com.ourteam.product.model.domain.ProductModelServiceTemplateBean;

public class ProductModelServiceTemplateSearchModel
		extends AbstractSearchModel<ProductModelServiceTemplateDAOQueryBean> {
	
	private String templateName;

	public String getTemplateName() {
		return templateName;
	}

	public void setTemplateName(String templateName) {
		this.templateName = templateName;
	}

	@Override
	public String getMappedDAOField(String aProperty) {
		return ProductModelServiceTemplateBean.getMappedDAOField(aProperty);
	}

	@Override
	protected void doBuildQueryBean(ProductModelServiceTemplateDAOQueryBean queryBean) throws Exception {
		
		ProductModelServiceTemplateDAOQueryBean.Criteria criteria = queryBean.createCriteria();
		
		if(StringUtils.isNotBlank(templateName)){
			criteria.andTemplateNameLike(templateName);
		}
		
	}

}
